package 算法.贪心算法;
//https://leetcode-cn.com/problems/minimum-cost-to-move-chips-to-the-same-position/comments/
public class 玩筹码 {
    public static void main(String[] args) {
        System.out.println(minCostToMoveChips(new int[]{2,2,2,3,3}));
    }

    public static int minCostToMoveChips(int[] position) {
        int n1 = 0; int n2 = 0;
        for (int i : position) {
            if((i & 1) == 0) n2 ++; //使用位运算 内存占用率超过100%
            else n1++;
        }
        return n1 > n2 ? n2:n1;
    }
}
